#include<stdio.h>
int main()
{
    long long int fenzi[110],fenmu[110],temp=0,product=0,mcm=0;
    int n=0,i,j,x=0;
    int fact=0,a=0,b1=0,b2=0;
    scanf("%d\n",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld/%lld",&fenzi[i],&fenmu[i]);
    }
    for(j=0;j<n;j++)
    {
        if(fenmu[j]<fenmu[j+1])
        {
            temp=fenmu[j];
            fenmu[j]=fenmu[j+1];
            fenmu[j+1]=temp;
        }
        product=fenmu[j]*fenmu[j+1];
        fact=fenmu[j]%fenmu[j+1];
        x=fenmu[j]/fenmu[j+1];
        if(fact!=0)
        {
        	while(fact!=0)
	        {
	            fenmu[j]=fenmu[j+1];
	            fenmu[j+1]=fact;
	            fact=fenmu[j]%fenmu[j+1];
	        }
        	mcm=product/fact;
	        fenzi[j+1]=fenzi[j]*mcm+fenzi[j+1]*mcm;
	        fenmu[j+1]=mcm;
	        printf("%lld",mcm);
	        printf("%lld %lld",fenzi[j+1],fenmu[j+1]);
		}
        else
        {
        	fenzi[j+1]=fenzi[j]+fenzi[j+1]*x;
		}
		if(j+1==n)
			break;
    }
    a=fenzi[n-1]/fenmu[n-1];
    b1=fenzi[n-1]%fenmu[n-1];
    b2=fenmu[n-1];
    printf("%d %d %d",a,b1,b2);
    if(a!=0)
    {
        if(b1==0)
            printf("%d",a);
        else
        {
            fact=b2%b1;
            while(fact!=0)
            {
                b2=b1;
                b1=fact;
                fact=b2%b1;
            }
            if(fact!=0)
            {
                printf("%d %d/%d",a,b1/fact,b2/fact);
            }
            else
                printf("%d %d/%d",a,b1,b2);
        }
    }
    else
        printf("%d/%d",b1,b2);
    return 0;
}



